package com.zzyl.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.zzyl.base.PageResponse;
import com.zzyl.enums.BasicEnum;
import com.zzyl.exception.BaseException;
import com.zzyl.mapper.CustomerOrdersMapper;
import com.zzyl.service.CustomerOrdersService;
import com.zzyl.utils.ObjectUtil;
import com.zzyl.vo.NursingProjectVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class CustomerOrdersServiceImpl implements CustomerOrdersService {
    @Autowired
    CustomerOrdersMapper customerOrdersMapper;
    @Override
    public PageResponse<NursingProjectVo> getByPage(String name, Integer status, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        Page<NursingProjectVo> nursingProjects = (Page<NursingProjectVo>) customerOrdersMapper.selectByPage(name, status);
        PageResponse<NursingProjectVo> projectVoPageResponse = PageResponse.of(nursingProjects, NursingProjectVo.class);
        return projectVoPageResponse;
    }

    @Override
    public NursingProjectVo getById(Long id) {
        NursingProjectVo nursingProjectVo = customerOrdersMapper.getById(id);

        return nursingProjectVo;
    }
}
